#include "dgt_ListCtrl.h"


dgt_ListCtrl::dgt_ListCtrl (void)
{

}
dgt_ListCtrl::~dgt_ListCtrl (void)
{

}
dgt_ListCtrl::dgt_ListCtrl (
							wxWindow *parent,
							wxWindowID id,
							const wxPoint& pos ,
							const wxSize& size ,
							long style ,
							const wxValidator& validator ,
							const wxString& name
							)
							: wxListCtrl (parent,id,pos,size, style, validator, name)
{
}
/************************************************************************************************/
// Function for append new line to list ctrl - must be called before settext or setlong
// inData - Data which must be linked to line
void dgt_ListCtrl:: NewLine(void* inData)
{
	wxListItem mItem;

	mItem.SetMask( wxLIST_MASK_TEXT );
	mItem.SetData( inData );
	mItem.SetId( 0 );
	mItem.SetColumn( 0 );
	mItem.SetText( _(" ") );

	this->InsertItem( mItem );
}
/***********************************************************************************************/
// Function for setting text of cell in list ctrl
// column - column of text
// text - text to set
// index - number of row
void dgt_ListCtrl::SetText( long column, const wxString& text,long index  )
{
	wxListItem mItem;

	mItem.SetColumn( column );

	if( index!= -1 )
		mItem.SetId( index );

	mItem.SetText( text );

	this->SetItem( mItem );
}
/***********************************************************************************************/
// Function for setting long value of cell in list ctrl
// column - column of text
// num - long value to set
// index - number of row
void dgt_ListCtrl:: SetLong( long column, long num, long index  )
{
	wxListItem mItem;

	wxString str;
	str = wxString::Format( _T("%d"), num );

	if( index!= -1 )
		mItem.SetId( index );

	mItem.SetColumn( column );
	mItem.SetText( str );

	this->SetItem( mItem );
}